<?php
namespace app\admin\controller;

<<<<<<< HEAD
class Index
{
=======
use think\Controller;

class Index extends Controller
{    //首页
>>>>>>> 0dcc7076340ef47ff7bf7298ea3825f7ae1707dd
    public function index()
    {

        return view();
    }
<<<<<<< HEAD
=======
       //登录视图
    public function login(){

        return view();
    }
    // 登录功能
    public function loginis(){
        $post = input('post.');
        $select = db('admin')->where(['user'=>$post['user'],'pwd'=>md5($post['pwd'])])->count();
        if($select){
            session('user',$post['user']);
            $this->success('登录成功',url('index'));
        }else{
            $this->error('登录失败');

        }
    }
    public function sign(){
        session('user',null);
        $this->error('退出成功',url('login'));
    }
    //注册
    public function reg(){
        $post = input('post.');
        $admin = validate('admin');
       if(!$admin->check($post)){
           $this->error($admin->getError());
       }
        $data = [
             'user'=>$post['user'],
             'pwd'=>md5($post['pwd']),
             'email'=>$post['email'],
             'phone'=>$post['phone']
        ];
          $select = db('admin')->where('user',$post['user'])->count();
        if($select){
            $this->success('用户已存在');
        }else{
            $select = db('admin')->where('email',$post['email'])->count();
            if($select){
                $this->success('邮箱已被注册');
            }else{
                $select = db('admin')->where('phone',$post['phone'])->count();
                if($select){
                    $this->success('手机号已被绑定');
                }else{
                    $insert = db('admin')->insert($data);
                    $this->success('添加成功');
                }

            }

        }
    }
    //数据表
    public function chart(){

        return view();
    }
    //Amaze ui 表单
    public function amazeui(){

        return view();
    }
    // 线条表单
    public function line(){

        return view();
    }
    //消息列表
    public function news(){

        return view();
    }
    //文字列表
    public function newslist(){

        return view();
    }
    //文字表格
    public function tablefont(){

        return view();
    }
    //图片表格
    public function tableimages(){

        return view();
    }
>>>>>>> 0dcc7076340ef47ff7bf7298ea3825f7ae1707dd
}
